From: kaf24@firebug.cl.cam.ac.uk Date: Sun, 21 May 2006 08:55:15 +0000 (+0100) Subject: [LOADER] Remove check for VIRT_BASE existence: it's not needed X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16047^2~14 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=e699658dbbbb97db11fc6c4bebf9aaffdc275db4;p=xen.git [LOADER] Remove check for VIRT_BASE existence: it's not needed to prevent xend crashign (when Aravindh's latest patch is applied) and breaks ia64. Also, ensure we set a reasonable default for elf_paddr_offset. Signed-off-by: Keir Fraser --- diff --git a/tools/libxc/xc_load_elf.c b/tools/libxc/xc_load_elf.c index 33b07bdb3f..80256d18f8 100644 --- a/tools/libxc/xc_load_elf.c +++ b/tools/libxc/xc_load_elf.c @@ -148,14 +148,9 @@ static int parseelfimage(const char *image, dsi->xen_guest_string = guestinfo; - if ( (p = strstr(guestinfo, "VIRT_BASE=")) == NULL ) - { - ERROR("Malformed ELF image. No VIRT_BASE specified"); - return -EINVAL; - } - - virt_base = strtoul(p+10, &p, 0); - + virt_base = 0; + if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) + virt_base = strtoul(p+10, &p, 0); dsi->elf_paddr_offset = virt_base; if ( (p = strstr(guestinfo, "ELF_PADDR_OFFSET=")) != NULL ) dsi->elf_paddr_offset = strtoul(p+17, &p, 0); @@ -172,10 +167,18 @@ static int parseelfimage(const char *image, kernend = vaddr + phdr->p_memsz; } - if ( virt_base ) - dsi->v_start = virt_base; - else + dsi->v_start = virt_base; + if ( dsi->v_start == 0 ) + { + /* + * Legacy compatibility and images with no __xen_guest section: + * assume header addresses are virtual addresses, and that + * guest memory should be mapped starting at kernel load address. + */ dsi->v_start = kernstart; + if ( dsi->elf_paddr_offset == 0 ) + dsi->elf_paddr_offset = dsi->v_start; + } dsi->v_kernentry = ehdr->e_entry; if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL ) diff --git a/xen/common/elf.c b/xen/common/elf.c index 83155e0e08..ef74673ab3 100644 --- a/xen/common/elf.c +++ b/xen/common/elf.c @@ -103,10 +103,18 @@ int parseelfimage(struct domain_setup_info *dsi) kernend = vaddr + phdr->p_memsz; } - if ( virt_base ) - dsi->v_start = virt_base; - else + dsi->v_start = virt_base; + if ( dsi->v_start == 0 ) + { + /* + * Legacy compatibility and images with no __xen_guest section: + * assume header addresses are virtual addresses, and that + * guest memory should be mapped starting at kernel load address. + */ dsi->v_start = kernstart; + if ( dsi->elf_paddr_offset == 0 ) + dsi->elf_paddr_offset = dsi->v_start; + } dsi->v_kernentry = ehdr->e_entry; if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )